package com.tancire.web.controller.market;

import com.tancire.common.annotation.Log;
import com.tancire.common.core.controller.BaseController;
import com.tancire.common.core.domain.AjaxResult;
import com.tancire.common.core.page.TableDataInfo;
import com.tancire.common.enums.BusinessType;
import com.tancire.common.utils.SecurityUtils;
import com.tancire.common.utils.poi.ExcelUtil;
import com.tancire.net.domain.CrmCompanyWithdraw;
import com.tancire.net.service.ICrmCompanyWithdrawService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 客户提现记录Controller
 *
 * @author chencho
 * @date 2023-12-25
 */
@RestController
@RequestMapping("/mkt/withdraw")
public class CrmCompanyWithdrawMktController extends BaseController {
    @Resource
    private ICrmCompanyWithdrawService crmCompanyWithdrawService;

    /**
     * 查询客户提现记录列表
     */
    @PreAuthorize("@ss.hasPermi('company:user:union')")
    @GetMapping("/list")
    public TableDataInfo list(CrmCompanyWithdraw crmCompanyWithdraw) {
        crmCompanyWithdraw.setCompanyId(SecurityUtils.getUserId());
        startPage();
        List<CrmCompanyWithdraw> list = crmCompanyWithdrawService.selectCrmCompanyWithdrawList(crmCompanyWithdraw);
        return getDataTable(list);
    }

    /**
     * 申请提现
     */
    @PreAuthorize("@ss.hasPermi('company:user:union')")
    @PostMapping("/apply")
    public AjaxResult apply(@RequestBody CrmCompanyWithdraw crmCompanyWithdraw) {
        return toAjax(crmCompanyWithdrawService.applyWithdraw(crmCompanyWithdraw));
    }

}
